import os
from dotenv import load_dotenv

load_dotenv()


class Config:
    # 模型路径
    MODEL_PATH = os.getenv('MODEL_PATH', 'weights/yolov8_13.pt')
    MODEL_VERSION = os.getenv('MODEL_VERSION', '1.0')  # 添加模型版本

    # 检测参数
    CONFIDENCE_THRESH = float(os.getenv('CONF_THRESH', 0.5))

    # 服务器配置
    HOST = os.getenv('HOST', '0.0.0.0')
    PORT = int(os.getenv('PORT', 5000))
    DEBUG = os.getenv('DEBUG', 'False').lower() in ('true', '1', 'yes')

    # 上传目录
    UPLOAD_FOLDER = os.getenv('UPLOAD_FOLDER', 'tmp_uploads')
    MAX_CONTENT_LENGTH = 1000 * 1024 * 1024  # 1000MB限制
    ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'mp4', 'avi', 'mov'}  # 添加允许的文件类型

    # 新增参数
    FLIGHT_HEIGHT = float(os.getenv('FLIGHT_HEIGHT', 0))
    SENSOR_WIDTH = float(os.getenv('SENSOR_WIDTH', 0))
    SENSOR_HEIGHT = float(os.getenv('SENSOR_HEIGHT', 0))
    FOCAL_LENGTH = float(os.getenv('FOCAL_LENGTH', 0))